Skip to main content

DB Dump Restore

In both Windows and Linux, you should ensure that the database user gqc exists.

Windows

  1. Open PG Admin
  2. If there's an existing orsanco database, rename adhering to the following format: orsanco_old_mmddyyyy.
  3. Create a new orsanco database.
  4. Check that the gqc user exists by expanding the server (i.e. PostgreSQL 13) and expanding the Login/Group Roles menu.
  5. Create the user and assign permissions if they don't exist:
    • Select (left-click) the orsanco database in the browser window.
    • Select the Tools dropdown and open an instance of the Query Tool.
    • Run the following commands:
      • create user gqc with password 'gq010102';
      • alter database orsanco owner to "gqc";
  6. Right click on the empty orsanco database and select restore.
  7. Navigate to and select the most recent database dump.

Linux VM

This walkthrough assumes you are already connected to the VM CLI.

  1. Get the Dropbox download link for the DB dump and copy it to your clipboard.

  2. In the CLI, type wget and paste the copied link. Make sure to remove any trailing URL parameters such as ?dl=0.

  3. Once the download has finished, switch to the postgres user with sudo su postgres

  4. Connect to the PSQL CLI with the command psql

  5. Rename the existing database in case you need to revert the changes with the command ALTER DATABASE orsanco RENAME TO orsanco_old_mmddyyyy;

  6. Create a new orsanco database with the command CREATE DATABASE orsanco;

  7. Check that the gqc user exists by running the command: \du

  8. Create the user and assign permissions if they don't exist:

    • create user gqc with password 'gq010102';
    • alter database orsanco owner to "gqc";
  9. Exit the PSQL CLI with the command \q

  10. Restore the DB dump with the command pg_restore -U postgres -d orsanco -1 orsanco_dump_mmddyyyy.backup

  11. Connect to the newly restored database in PSQL CLI with the command psql -d orsanco

  12. Grant the existing gqc user all permissions on the public schema with the command grant all privileges on all tables in schema public to gqc;

  13. Exit the PSQL CLI with the command \q

  14. Exit the postgres user with the command exit